namespace pos.entity
{
using System;
using System.Data;
using System.Configuration;
using System.Text;
using System.Data.OleDb;
using System.Collections;
using System.Windows.Forms;
using NHibernate;
using NHibernate.Criterion;
/// <summary>
/// t_eorder 的摘要说明
/// </summary>
public class t_eorder:IEntityUtil
{
//   状态值的哈希表 
	private static Hashtable m_enum_orderState;
	public static Hashtable  enum_orderState
	{
		get{return m_enum_orderState;}
	}
	public const int Confirming=0;
	public const int ready=0;
	public const int sending=0;
	public const int over=0;
	public const int cancel=0;
//   状态值的哈希表 
	private static Hashtable m_enum_moneyState;
	public static Hashtable  enum_moneyState
	{
		get{return m_enum_moneyState;}
	}
	public const int paid=0;
	public const int unpaid=0;
	//   列名称哈希表 
	private static Hashtable m_colLabels;    	 
	public static Hashtable colLabels//
	{
		get{return m_colLabels;}
	}
	//表字段名称哈希表
	private static ArrayList m_colNames;     
	public static ArrayList  colNames　
	{
		get{return m_colNames;}
	}
	private Eorder __eorder;
	public String id  
	{
		get{return __eorder.id;}
		set{ __eorder.id=value;}
	}
	public String orderNO  
	{
		get{return __eorder.orderNO;}
		set{ __eorder.orderNO=value;}
	}
	public String address  
	{
		get{return __eorder.address;}
		set{ __eorder.address=value;}
	}
	public String mobile  
	{
		get{return __eorder.mobile;}
		set{ __eorder.mobile=value;}
	}
	public String phone  
	{
		get{return __eorder.phone;}
		set{ __eorder.phone=value;}
	}
	public String contacter  
	{
		get{return __eorder.contacter;}
		set{ __eorder.contacter=value;}
	}
	public double amount  
	{
		get{return __eorder.amount;}
		set{ __eorder.amount=value;}
	}
	public double money  
	{
		get{return __eorder.money;}
		set{ __eorder.money=value;}
	}
	public String userID  
	{
		get{return __eorder.userID;}
		set{ __eorder.userID=value;}
	}
	public long cashboxNO  
	{
		get{return __eorder.cashboxNO;}
		set{ __eorder.cashboxNO=value;}
	}
	public String memberSeqID  
	{
		get{return __eorder.memberSeqID;}
		set{ __eorder.memberSeqID=value;}
	}
	public DateTime orderTime  
	{
		get{return __eorder.orderTime;}
		set{ __eorder.orderTime=value;}
	}
	public int orderState  
	{
		get{return __eorder.orderState;}
		set{ __eorder.orderState=value;}
	}
	public int moneyState  
	{
		get{return __eorder.moneyState;}
		set{ __eorder.moneyState=value;}
	}
	private static  EorderDao dao=(EorderDao)SpringContext.Context.GetObject("EorderDao");
	public static EorderDao DAO
	{
		get{return dao;}
		
	}
	
	public t_eorder()
	{
		__eorder=new Eorder();
	  	id="";
	  	orderNO="";
	  	address="";
	  	mobile="";
	  	phone="";
	  	contacter="";
	  	amount=consts.double_min;
	  	money=consts.double_min;
	  	userID="";
	  	cashboxNO=consts.long_min;
	  	memberSeqID="";
	  	orderTime=DateTime.Now;
	  	orderState=consts.int_min;
	  	moneyState=consts.int_min;
	  // dao=(EorderDao)SpringContext.Context.GetObject("EorderDao");
	   if(m_colLabels==null)
	   {
		m_colLabels = new Hashtable();
        m_colNames= new ArrayList();
		m_colLabels.Add("id", @"主键");
		colNames.Add("id");
		m_colLabels.Add("orderNO", @"订单号码");
		colNames.Add("orderNO");
		m_colLabels.Add("address", @"送货地址");
		colNames.Add("address");
		m_colLabels.Add("mobile", @"手机号码");
		colNames.Add("mobile");
		m_colLabels.Add("phone", @"固定电话");
		colNames.Add("phone");
		m_colLabels.Add("contacter", @"联系人");
		colNames.Add("contacter");
		m_colLabels.Add("amount", @"合计数量");
		colNames.Add("amount");
		m_colLabels.Add("money", @"合计金额");
		colNames.Add("money");
		m_colLabels.Add("userID", @"处理人");
		colNames.Add("userID");
		m_colLabels.Add("cashboxNO", @"钱箱");
		colNames.Add("cashboxNO");
		m_colLabels.Add("memberSeqID", @"会员编号");
		colNames.Add("memberSeqID");
		m_colLabels.Add("orderTime", @"订单时间");
		colNames.Add("orderTime");
		m_colLabels.Add("orderState", @"状态");
		colNames.Add("orderState");
		m_enum_orderState= new Hashtable();
		m_enum_orderState.Add("0", @"等待确认");
		m_enum_orderState.Add("0", @"配货中");
		m_enum_orderState.Add("0", @"送货中");
		m_enum_orderState.Add("0", @"完成");
		m_enum_orderState.Add("0", @"撤销");
		m_colLabels.Add("moneyState", @"状态");
		colNames.Add("moneyState");
		m_enum_moneyState= new Hashtable();
		m_enum_moneyState.Add("0", @"已付款");
		m_enum_moneyState.Add("0", @"未付款");
	  }
	
	}
	public t_eorder(Eorder entity )
	{
		__eorder=entity;
		
	  // dao=(EorderDao)SpringContext.Context.GetObject("EorderDao");
	   if(m_colLabels==null)
	   {
		m_colLabels = new Hashtable();
        m_colNames= new ArrayList();
		m_colLabels.Add("id", @"主键");
		colNames.Add("id");
		m_colLabels.Add("orderNO", @"订单号码");
		colNames.Add("orderNO");
		m_colLabels.Add("address", @"送货地址");
		colNames.Add("address");
		m_colLabels.Add("mobile", @"手机号码");
		colNames.Add("mobile");
		m_colLabels.Add("phone", @"固定电话");
		colNames.Add("phone");
		m_colLabels.Add("contacter", @"联系人");
		colNames.Add("contacter");
		m_colLabels.Add("amount", @"合计数量");
		colNames.Add("amount");
		m_colLabels.Add("money", @"合计金额");
		colNames.Add("money");
		m_colLabels.Add("userID", @"处理人");
		colNames.Add("userID");
		m_colLabels.Add("cashboxNO", @"钱箱");
		colNames.Add("cashboxNO");
		m_colLabels.Add("memberSeqID", @"会员编号");
		colNames.Add("memberSeqID");
		m_colLabels.Add("orderTime", @"订单时间");
		colNames.Add("orderTime");
		m_colLabels.Add("orderState", @"状态");
		colNames.Add("orderState");
		m_enum_orderState= new Hashtable();
		m_enum_orderState.Add("0", @"等待确认");
		m_enum_orderState.Add("0", @"配货中");
		m_enum_orderState.Add("0", @"送货中");
		m_enum_orderState.Add("0", @"完成");
		m_enum_orderState.Add("0", @"撤销");
		m_colLabels.Add("moneyState", @"状态");
		colNames.Add("moneyState");
		m_enum_moneyState= new Hashtable();
		m_enum_moneyState.Add("0", @"已付款");
		m_enum_moneyState.Add("0", @"未付款");
	  }
	
	}
	public Object uniqueResult(DetachedCriteria dc)
    {
        return dao.uniqueResult(dc);
    }
	 public DetachedCriteria DC 
     {
        	get{return DetachedCriteria.For(typeof(Eorder));}
     }
	public const string ENTITYNAME="t_eorder";
	public const int SEQN0=288;
	
    public void checkAdd()
    {
		int len;
	
	len=id.Trim().Length;
	if(len>32)
		 throw (new Exception("主键字符长度最长不能超过32,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("主键不能为空!"));	
	
 if(id=="0")
	 throw (new Exception("主键是主健，框架要求值不能为0"));				

	
	len=orderNO.Trim().Length;
	if(len>32)
		 throw (new Exception("订单号码字符长度最长不能超过32,当前长度为"+len.ToString()));	
	

	
	len=address.Trim().Length;
	if(len>80)
		 throw (new Exception("送货地址字符长度最长不能超过80,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("送货地址不能为空!"));	
	

	
	len=mobile.Trim().Length;
	if(len>20)
		 throw (new Exception("手机号码字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("手机号码不能为空!"));	
	

	
	len=phone.Trim().Length;
	if(len>50)
		 throw (new Exception("固定电话字符长度最长不能超过50,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("固定电话不能为空!"));	
	

	
	len=contacter.Trim().Length;
	if(len>20)
		 throw (new Exception("联系人字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("联系人不能为空!"));	
	

	//try{Convert.ToDouble(amount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	amount<consts.double_min+1)
			throw (new Exception("请输入合计数量"));
		if(amount>0)
			amount+=0.000001;
		if(amount<0)
			amount-=0.000001;
		
			if(((long)((amount)*100 ))*10!=(long)((amount)*1000) )
				throw (new Exception("合计数量小数精度不能大于2位amount="+amount.ToString()));
		if(amount>0)
			amount-=0.000001;
		if(amount<0)
			amount+=0.000001;
	

	//try{Convert.ToDouble(money);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	money<consts.double_min+1)
			throw (new Exception("请输入合计金额"));
		if(money>0)
			money+=0.000001;
		if(money<0)
			money-=0.000001;
		
			if(((long)((money)*10000 ))*10!=(long)((money)*100000) )
				throw (new Exception("合计金额小数精度不能大于4位money="+money.ToString()));
		if(money>0)
			money-=0.000001;
		if(money<0)
			money+=0.000001;
	

	
	len=userID.Trim().Length;
	if(len>20)
		 throw (new Exception("处理人字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("处理人不能为空!"));	
	

	//try{Convert.ToInt64(cashboxNO);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	cashboxNO<consts.long_min+1)
			throw (new Exception("请输入钱箱"));

	
	len=memberSeqID.Trim().Length;
	if(len>50)
		 throw (new Exception("会员编号字符长度最长不能超过50,当前长度为"+len.ToString()));	
	

	//try{Convert.ToDateTime(orderTime);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	orderTime.ToString().CompareTo(consts.datetime_min) <= 0 )
			throw (new Exception("请输入订单时间"));

	//try{Convert.ToInt32(orderState);}catch{ throw (new Exception("请输入正确的整数格式"));		}
		if(	orderState<consts.int_min+1)
			throw (new Exception("请输入状态"));

	//try{Convert.ToInt32(moneyState);}catch{ throw (new Exception("请输入正确的整数格式"));		}
		if(	moneyState<consts.int_min+1)
			throw (new Exception("请输入状态"));

//unique="yes" 唯一性验证
    }
    public void checkUpdate()
    {
		int len;
	
	len=id.Trim().Length;
	if(len>32)
		 throw (new Exception("主键字符长度最长不能超过32,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("主键不能为空!"));	
	
 if(id=="0")
	 throw (new Exception("主键是主健，框架要求值不能为0"));				

	
	len=orderNO.Trim().Length;
	if(len>32)
		 throw (new Exception("订单号码字符长度最长不能超过32,当前长度为"+len.ToString()));	
	

	
	len=address.Trim().Length;
	if(len>80)
		 throw (new Exception("送货地址字符长度最长不能超过80,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("送货地址不能为空!"));	
	

	
	len=mobile.Trim().Length;
	if(len>20)
		 throw (new Exception("手机号码字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("手机号码不能为空!"));	
	

	
	len=phone.Trim().Length;
	if(len>50)
		 throw (new Exception("固定电话字符长度最长不能超过50,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("固定电话不能为空!"));	
	

	
	len=contacter.Trim().Length;
	if(len>20)
		 throw (new Exception("联系人字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("联系人不能为空!"));	
	

	//try{Convert.ToDouble(amount);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	amount<consts.double_min+1)
			throw (new Exception("请输入合计数量"));
		if(amount>0)
			amount+=0.000001;
		if(amount<0)
			amount-=0.000001;
		
			if(((long)((amount)*100 ))*10!=(long)((amount)*1000) )
				throw (new Exception("合计数量小数精度不能大于2位amount="+amount.ToString()));
		if(amount>0)
			amount-=0.000001;
		if(amount<0)
			amount+=0.000001;
	

	//try{Convert.ToDouble(money);}catch{ throw (new Exception("请输入正确的小数格式"));		}
		if(	money<consts.double_min+1)
			throw (new Exception("请输入合计金额"));
		if(money>0)
			money+=0.000001;
		if(money<0)
			money-=0.000001;
		
			if(((long)((money)*10000 ))*10!=(long)((money)*100000) )
				throw (new Exception("合计金额小数精度不能大于4位money="+money.ToString()));
		if(money>0)
			money-=0.000001;
		if(money<0)
			money+=0.000001;
	

	
	len=userID.Trim().Length;
	if(len>20)
		 throw (new Exception("处理人字符长度最长不能超过20,当前长度为"+len.ToString()));	
	else if(len==0)
		throw (new Exception("处理人不能为空!"));	
	

	//try{Convert.ToInt64(cashboxNO);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	cashboxNO<consts.long_min+1)
			throw (new Exception("请输入钱箱"));

	
	len=memberSeqID.Trim().Length;
	if(len>50)
		 throw (new Exception("会员编号字符长度最长不能超过50,当前长度为"+len.ToString()));	
	

	//try{Convert.ToDateTime(orderTime);}catch{ throw (new Exception("请输入正确的长整数格式"));		}
		if(	orderTime.ToString().CompareTo(consts.datetime_min) <= 0 )
			throw (new Exception("请输入订单时间"));

	//try{Convert.ToInt32(orderState);}catch{ throw (new Exception("请输入正确的整数格式"));		}
		if(	orderState<consts.int_min+1)
			throw (new Exception("请输入状态"));

	//try{Convert.ToInt32(moneyState);}catch{ throw (new Exception("请输入正确的整数格式"));		}
		if(	moneyState<consts.int_min+1)
			throw (new Exception("请输入状态"));

//unique="yes" 唯一性验证
		ICriterion crit=Restrictions.Eq("id", id);
  		IList list=dao.List(dao.DC.Add(crit));
		if(list.Count==1)
			return;
		if(list.Count==0)
			throw (new Exception("该记录已经被删除"));	
		else
			throw (new Exception("改纪录出现重名!"));
    }
    public void add()
    {
        try
        {
            checkAdd();
         	dao.Add(__eorder);
        }
        catch(Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
   
    public void delByid()
    {
    
        try
        {
          dao.Delete(__eorder);
        }
        catch(Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }

    public  void update()
    {
        try
        {
            checkUpdate();
            dao.Update(__eorder);
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
   
    public void ExecDataUpdate(int rowNo)
    {
		if(m_updateRow==null)
			return;
		int ii=0;
m_updateRow(rowNo,ii++,id);	
m_updateRow(rowNo,ii++,mobile);	
m_updateRow(rowNo,ii++,phone);	
m_updateRow(rowNo,ii++,contacter);	
m_updateRow(rowNo,ii++,/***/(						string.Format("{0:F2}",amount)/***/)
);	

    }
    public void ExecHeadInsert()
    {
		if(m_insertHead!=null)
        {
			int ii=0;
			m_insertHead(ii++,80,"主键");
			m_insertHead(ii++,200,"手机号码");
			m_insertHead(ii++,250,"固定电话");
			m_insertHead(ii++,100,"联系人");
			m_insertHead(ii++,80,"合计数量");
		}		
    }
    public void ExecDataInsert()
	{
		if(m_insertRow==null)
			return;
		int ii=0;
     	m_insertRow(0,ii++,id);
     	m_insertRow(0,ii++,mobile);
     	m_insertRow(0,ii++,phone);
     	m_insertRow(0,ii++,contacter);
     	m_insertRow(0,ii++,/***/(						string.Format("{0:F2}",amount)/***/)
);
    }
    public void ExecDataInsertByQuery(DetachedCriteria dc)
    {
      
         IList list=dao.List(dc); 
        
        if(m_insertHead!=null)
        {
			int ii=0;
			m_insertHead(ii++,80,"主键");
			m_insertHead(ii++,200,"手机号码");
			m_insertHead(ii++,250,"固定电话");
			m_insertHead(ii++,100,"联系人");
			m_insertHead(ii++,80,"合计数量");
		}		
		
      if(m_insertRow!=null)
      {
        int j=0;
        foreach(Eorder obj in list)			
        {
		  int ii=0;
	     
m_insertRow(j,ii++,obj.id.ToString());
m_insertRow(j,ii++,obj.mobile.ToString());
m_insertRow(j,ii++,obj.phone.ToString());
m_insertRow(j,ii++,obj.contacter.ToString());
m_insertRow(j,ii++,(					string.Format("{0:F2}",obj.amount)
					)
);
		j++;
        }
        

	
       }
    }

    
    public IList List(DetachedCriteria dc)
    {
        try
        {
           
            return dao.List(dc);
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
        }
    }
    
    public bool Init(DetachedCriteria dc)
    {
    
    		Eorder obj=dao.Get(dc);
    		if(obj==null)
    			return false;
    		else
    		{
    			__eorder=obj;
            	return true;
            }
        
    }
    public static t_eorder Get(DetachedCriteria dc)
    {
    	
    	Eorder obj=((EorderDao)SpringContext.Context.GetObject("EorderDao"))
	 	.Get(dc);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_eorder( obj );
        
    }
	 public static t_eorder GetById(String val)
	 {
	 	Eorder obj=((EorderDao)SpringContext.Context.GetObject("EorderDao"))
	 	.GetById(val);
	 	if(obj==null)
	 		return null;
	 	else
	 		return new t_eorder( obj );
	 	
	 	
	 }
	 public  bool InitById(String val)
	 {
	 	

	 	Eorder obj=dao.GetById(val) ;
	 	if(obj==null)
	 		return false;
	 	else
	 	{
	 		__eorder=obj;
	 		return true;
	 	}
	 	
	 	
	 }
    
       public bool showInForm(Control.ControlCollection Controls)
    {
        try
        {
             
		if(Controls["id"]!=null)
		{
			Controls["id"].Text=id;
		}
		if(Controls["orderNO"]!=null)
		{
			Controls["orderNO"].Text=orderNO;
		}
		if(Controls["address"]!=null)
		{
			Controls["address"].Text=address;
		}
		if(Controls["mobile"]!=null)
		{
			Controls["mobile"].Text=mobile;
		}
		if(Controls["phone"]!=null)
		{
			Controls["phone"].Text=phone;
		}
		if(Controls["contacter"]!=null)
		{
			Controls["contacter"].Text=contacter;
		}
		if(Controls["amount"]!=null)
		{
			Controls["amount"].Text=/***/(						string.Format("{0:F2}",amount)/***/)
;
		}
		if(Controls["money"]!=null)
		{
			Controls["money"].Text=/***/(						string.Format("{0:F4}",money)/***/)
;
		}
		if(Controls["userID"]!=null)
		{
			Controls["userID"].Text=userID;
		}
		if(Controls["cashboxNO"]!=null)
		{
			Controls["cashboxNO"].Text=				(				  string.Format("{0}",cashboxNO)				  );
		}
		if(Controls["memberSeqID"]!=null)
		{
			Controls["memberSeqID"].Text=memberSeqID;
		}
		if(Controls["orderTime"]!=null)
		{
			Controls["orderTime"].Text=			orderTime.ToString().CompareTo("1001-1-1")<0?"":string.Format("{0:g}",orderTime);
		}
		if(Controls["orderState"]!=null)
		{
			Controls["orderState"].Text=	t_eorder.enum_orderState[orderState.ToString()].ToString()
;
		}
		if(Controls["moneyState"]!=null)
		{
			Controls["moneyState"].Text=	t_eorder.enum_moneyState[moneyState.ToString()].ToString()
;
		}
			return true;
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
            
        }
    }
    public  t_eorder Init(Eorder item)
    {
        __eorder=item;
        return this;
    }

    
     public bool initByForm(Control.ControlCollection Controls)
    {
        try
        {
             
		if(Controls["id"]!=null)
		{
			
			if(Controls["id"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["id"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{id=v;}
				catch
				{
					 Controls["id"].Focus();
					throw  (new Exception("主键格式不正确！！"));
				}
				
			}
			else
			{
				try{id=Controls["id"].Text;}
				catch
				{
					 Controls["id"].Focus();
					throw  (new Exception("主键格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["orderNO"]!=null)
		{
			
			if(Controls["orderNO"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["orderNO"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{orderNO=v;}
				catch
				{
					 Controls["orderNO"].Focus();
					throw  (new Exception("订单号码格式不正确！！"));
				}
				
			}
			else
			{
				try{orderNO=Controls["orderNO"].Text;}
				catch
				{
					 Controls["orderNO"].Focus();
					throw  (new Exception("订单号码格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["address"]!=null)
		{
			
			if(Controls["address"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["address"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{address=v;}
				catch
				{
					 Controls["address"].Focus();
					throw  (new Exception("送货地址格式不正确！！"));
				}
				
			}
			else
			{
				try{address=Controls["address"].Text;}
				catch
				{
					 Controls["address"].Focus();
					throw  (new Exception("送货地址格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["mobile"]!=null)
		{
			
			if(Controls["mobile"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["mobile"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{mobile=v;}
				catch
				{
					 Controls["mobile"].Focus();
					throw  (new Exception("手机号码格式不正确！！"));
				}
				
			}
			else
			{
				try{mobile=Controls["mobile"].Text;}
				catch
				{
					 Controls["mobile"].Focus();
					throw  (new Exception("手机号码格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["phone"]!=null)
		{
			
			if(Controls["phone"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["phone"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{phone=v;}
				catch
				{
					 Controls["phone"].Focus();
					throw  (new Exception("固定电话格式不正确！！"));
				}
				
			}
			else
			{
				try{phone=Controls["phone"].Text;}
				catch
				{
					 Controls["phone"].Focus();
					throw  (new Exception("固定电话格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["contacter"]!=null)
		{
			
			if(Controls["contacter"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["contacter"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{contacter=v;}
				catch
				{
					 Controls["contacter"].Focus();
					throw  (new Exception("联系人格式不正确！！"));
				}
				
			}
			else
			{
				try{contacter=Controls["contacter"].Text;}
				catch
				{
					 Controls["contacter"].Focus();
					throw  (new Exception("联系人格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["amount"]!=null)
		{
			
			if(Controls["amount"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["amount"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{amount=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["amount"].Focus();
					throw  (new Exception("合计数量格式不正确！！"));
				}
				
			}
			else
			{
				try{amount=(Controls["amount"].Text==""?consts.double_min:Convert.ToDouble(Controls["amount"].Text));}
				catch
				{
					 Controls["amount"].Focus();
					throw  (new Exception("合计数量格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["money"]!=null)
		{
			
			if(Controls["money"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["money"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{money=(v==""?consts.double_min:Convert.ToDouble(v));}
				catch
				{
					 Controls["money"].Focus();
					throw  (new Exception("合计金额格式不正确！！"));
				}
				
			}
			else
			{
				try{money=(Controls["money"].Text==""?consts.double_min:Convert.ToDouble(Controls["money"].Text));}
				catch
				{
					 Controls["money"].Focus();
					throw  (new Exception("合计金额格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["userID"]!=null)
		{
			
			if(Controls["userID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["userID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{userID=v;}
				catch
				{
					 Controls["userID"].Focus();
					throw  (new Exception("处理人格式不正确！！"));
				}
				
			}
			else
			{
				try{userID=Controls["userID"].Text;}
				catch
				{
					 Controls["userID"].Focus();
					throw  (new Exception("处理人格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["cashboxNO"]!=null)
		{
			
			if(Controls["cashboxNO"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["cashboxNO"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{cashboxNO=(v==""?consts.long_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["cashboxNO"].Focus();
					throw  (new Exception("钱箱格式不正确！！"));
				}
				
			}
			else
			{
				try{cashboxNO=(Controls["cashboxNO"].Text==""?consts.long_min:Convert.ToInt32(Controls["cashboxNO"].Text));}
				catch
				{
					 Controls["cashboxNO"].Focus();
					throw  (new Exception("钱箱格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["memberSeqID"]!=null)
		{
			
			if(Controls["memberSeqID"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["memberSeqID"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{memberSeqID=v;}
				catch
				{
					 Controls["memberSeqID"].Focus();
					throw  (new Exception("会员编号格式不正确！！"));
				}
				
			}
			else
			{
				try{memberSeqID=Controls["memberSeqID"].Text;}
				catch
				{
					 Controls["memberSeqID"].Focus();
					throw  (new Exception("会员编号格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["orderTime"]!=null)
		{
			
			if(Controls["orderTime"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["orderTime"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{orderTime=(v==""?new DateTime(1000,1,1):Convert.ToDateTime(v));}
				catch
				{
					 Controls["orderTime"].Focus();
					throw  (new Exception("订单时间格式不正确！！"));
				}
				
			}
			else
			{
				try{orderTime=(Controls["orderTime"].Text==""?new DateTime(1000,1,1):Convert.ToDateTime(Controls["orderTime"].Text));}
				catch
				{
					 Controls["orderTime"].Focus();
					throw  (new Exception("订单时间格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["orderState"]!=null)
		{
			
			if(Controls["orderState"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["orderState"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{orderState=(v==""?consts.int_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["orderState"].Focus();
					throw  (new Exception("状态格式不正确！！"));
				}
				
			}
			else
			{
				try{orderState=(Controls["orderState"].Text==""?consts.int_min:Convert.ToInt32(Controls["orderState"].Text));}
				catch
				{
					 Controls["orderState"].Focus();
					throw  (new Exception("状态格式不正确！！"));
				}
				
			}
				
				
		}
		if(Controls["moneyState"]!=null)
		{
			
			if(Controls["moneyState"].GetType().Name=="ComboBox")
			{
				ComboBox box=(ComboBox)Controls["moneyState"];
				
				string v=box.SelectedValue==null?box.Text:Convert.ToString(box.SelectedValue);
				try{moneyState=(v==""?consts.int_min:Convert.ToInt32(v));}
				catch
				{
					 Controls["moneyState"].Focus();
					throw  (new Exception("状态格式不正确！！"));
				}
				
			}
			else
			{
				try{moneyState=(Controls["moneyState"].Text==""?consts.int_min:Convert.ToInt32(Controls["moneyState"].Text));}
				catch
				{
					 Controls["moneyState"].Focus();
					throw  (new Exception("状态格式不正确！！"));
				}
				
			}
				
				
		}
			return true;
        }
        catch (Exception ex)
        {
            throw (new Exception(ex.Message));
            
        }
    }
    

}

}
